<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
   xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
   xmlns:f="http://xmlns.jcp.org/jsf/core"
   xmlns:h="http://xmlns.jcp.org/jsf/html"
   xmlns:p="http://primefaces.org/ui"
   xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
   template="/WEB-INF/templates/business/supplier/template.xhtml">
   
    <f:metadata>
	   	<f:viewParam name="serviceSupplierId" value="#{serviceSupplierHome.id}"></f:viewParam>	   	
	   	<f:event listener="#{serviceSupplierHome.initConversation()}" type="preRenderView"></f:event>
	   	<f:viewParam name="moduleName" value="中介用户管理"></f:viewParam>
   	</f:metadata>
   
    <ui:define name="supplier_content">
   
	   <h:form id="editForm">         
	        <p:messages id="messages" closable="true">
	       		<p:autoUpdate />
	       	</p:messages>
   			<p:panel id="baseInfo" header="修改中介用户" style="margin-bottom:10px;">		        
		        <h:panelGrid columns="2" cellpadding="5">
		        	<p:outputLabel
						for="cnname"
						value="公司名称"
					/>
					<p:inputText
						id="cnname"
						value="#{serviceSupplierHome.instance.cnname}"
						required="true"
						styleClass="input-large"
					/>
					
					<p:outputLabel
						for="creditCode"
						value="统一社会信用代码"
					/>
					<p:inputText
						id="creditCode"
						value="#{serviceSupplierHome.instance.creditCode}"
						required="true"
						styleClass="input-large"
					/>
	
					<p:outputLabel
						for="address"
						value="办公地址"
					/>
					<p:inputText
						id="address"
						value="#{serviceSupplierHome.instance.address}"
						required="true"
						styleClass="input-xlarge"
					/>

					<p:outputLabel
						for="legalPerson"
						value="法定代表人"
					/>
					<p:inputText
						id="legalPerson"
						value="#{serviceSupplierHome.instance.legalPerson}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="legalPersonPhoneNumber"
						value="法定代表人联系电话"
					/>
					<p:inputText
						id="legalPersonPhoneNumber"
						value="#{serviceSupplierHome.instance.legalPersonPhoneNumber}"
						required="true"
						styleClass="input-small"
					/>

					<p:outputLabel
						for="firstContactor"
						value="第一联系人"
					/>
					<p:inputText
						id="firstContactor"
						value="#{serviceSupplierHome.instance.firstContactor}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="firstContactorPhoneNumber"
						value="第一联系人电话"
					/>
					<p:inputText
						id="firstContactorPhoneNumber"
						value="#{serviceSupplierHome.instance.firstContactorPhoneNumber}"
						required="true"
						styleClass="input-small"
					/>

					<p:outputLabel
						for="secondContactor"
						value="第二联系人"
					/>
					<p:inputText
						id="secondContactor"
						value="#{serviceSupplierHome.instance.secondContactor}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="secondContactorPhoneNumber"
						value="第二联系人电话"
					/>
					<p:inputText
						id="secondContactorPhoneNumber"
						value="#{serviceSupplierHome.instance.secondContactorPhoneNumber}"
						required="true"
						styleClass="input-small"
					/>

					<p:outputLabel
						for="employeeCount"
						value="员工数"
					/>
					<p:inputText
						id="employeeCount"
						value="#{serviceSupplierHome.instance.employeeCount}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="highTitleEmployeeCount"
						value="高级职称人数"
					/>
					<p:inputText
						id="highTitleEmployeeCount"
						value="#{serviceSupplierHome.instance.highTitleEmployeeCount}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="mediumTitleEmployeeCount"
						value="中级职称人数"
					/>
					<p:inputText
						id="mediumTitleEmployeeCount"
						value="#{serviceSupplierHome.instance.mediumTitleEmployeeCount}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="beginnerTitleEmployeeCount"
						value="初级职称人数"
					/>
					<p:inputText
						id="beginnerTitleEmployeeCount"
						value="#{serviceSupplierHome.instance.beginnerTitleEmployeeCount}"
						required="true"
						styleClass="input-mini"
					/>

					<p:outputLabel
						for="govServiceSupplier"
						value="是否政府服务供应商"
					/>
					<p:selectBooleanCheckbox
						id="govServiceSupplier"
						value="#{serviceSupplierHome.instance.govServiceSupplier}"
					/>

					<p:outputLabel
						for="region"
						value="中介机构所在地区"
					/>
					<p:selectOneMenu id="region"
									 value="#{serviceSupplierHome.instance.region}"
									 required="true">
						<f:selectItem itemLabel="请选择" itemValue="#{null}"  />
						<f:selectItems value="#{codeDicUtils.getCodeDicList('所在地区')}" var="_codeDic" itemValue="#{_codeDic.codeValue}"
									   itemLabel="#{_codeDic.codeName}" />
					</p:selectOneMenu>
					
					<p:outputLabel
						for="intro"
						value="机构简介"
					/>
					<p:inputTextarea
						id="intro"
						value="#{serviceSupplierHome.instance.intro}"
						required="true"
						rows="5"
						styleClass="input-xlarge"
					/>
	
				</h:panelGrid>
			</p:panel>
			
			<p:panel id="attachmentsPanel" header="相关附件"
				style="margin-bottom:10px;"
				styleClass="nureg-cont nuregcbox nuregcboxsty">
				<p:fileUpload id="attachmentUploadFile" label="选择" mode="advanced"
					required="true" multiple="true" skinSimple="true"
					sizeLimit="#{1024 * 1024 * 3}" uploadLabel="上传" cancelLabel="取消"
					update="editForm:uploadedAttachments"
					fileUploadListener="#{serviceSupplierHome.uploadAttachment}" />
				<p:panel id="uploadedAttachments">
					<ul>
						<p:repeat var="_attachment"
							value="#{serviceSupplierHome.instance.attachments}">
							<li><h:outputText value="#{_attachment.filename}" /> <span>
									<p:commandLink
										action="#{serviceSupplierHome.removeAttachment(_attachment)}"
										update="editForm:uploadedAttachments" immediate="true">×</p:commandLink>
							</span></li>
						</p:repeat>
					</ul>
				</p:panel>
			</p:panel>
   			<p:commandButton action="#{serviceSupplierHome.saveAndFlush()}" value="保存" ajax="true" />
	   	</h:form>
   </ui:define>
   
</ui:composition>
